package com.calis.ill.order;

import java.util.concurrent.CountDownLatch;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.PlatformTransactionManager;

//@EnableTransactionManagement
@SpringBootApplication
@ImportResource({"classpath:dubbo-provider.xml"})
public class App {

	private static final Logger logger = LoggerFactory.getLogger(App.class);

    @Bean
    public CountDownLatch closeLatch() {
        return new CountDownLatch(1);
    }
    
    @Bean
    public Object testBean(PlatformTransactionManager platformTransactionManager){
    	logger.info(">>>>>>>>>>" + platformTransactionManager.getClass().getName());
        return new Object();
    }

    public static void main(String[] args) throws InterruptedException {
        ApplicationContext ctx = new SpringApplicationBuilder().sources(App.class).web(false).run(args);

        logger.info("ill order provider 启动!");

        CountDownLatch closeLatch = ctx.getBean(CountDownLatch.class);
        closeLatch.await();
    }
}
